package com.qf.lyw1225.springboot.controller;

import com.qf.lyw1225.springboot.entity.User;
import com.qf.lyw1225.springboot.service.ILoginService;
import com.qf.lyw1225.springboot.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author :wsh
 * @date : 2024/12/25
 */
@Api(tags = "登录注册模块")
@RestController
@CrossOrigin
public class LoginController {
    @Resource
    private ILoginService iLoginService;

    @ApiOperation(value = "登录")
    @PostMapping("/login")
    public Result login(@RequestBody User user) {
        Result login = iLoginService.login(user);
        return login;

    }
    @ApiOperation(value = "注册")
    @PostMapping("/register")
    public Result register(@RequestBody User user) {
        Result register = iLoginService.register(user);
        return register;

    }

    @ApiOperation(value = "更新查询单条id")
    @GetMapping("/selectById/{id}")
    public Result selectById(@PathVariable("id") Integer id) {
        Result register = iLoginService.selectById(id);
        return register;

    }



}
